Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 2 - Control Manager Reference / Control Manager Types and Constants


The Control Font Style Structure

NEW WITH THE APPEARANCE MANAGER

You can pass a pointer to the control font style structure in the inStyle parameter of SetControlFontStyle to specify a control's font. If none of the flags in the flags field of the structure are set, the control uses the system font unless the control variant kControlUsesOwningWindowsFontVariant has been specified, in which case the control uses the window font.

If you wish to specify the font for controls in a dialog box, use a dialog font table resource, which is automatically read in by the Dialog Manager; see "The Dialog Control Font Table Resource".

A control font style structure is of type ControlFontStyleRec:

struct ControlFontStyleRec {
SInt16               flags;
SInt16               font;
SInt16               size;
SInt16               style;
SInt16               mode;
SInt16               just;
RGBColor          foreColor;
RGBColor          backColor;
};
typedef struct ControlFontStyleRec ControlFontStyleRec;
typedef ControlFontStyleRec *ControlFontStylePtr;
Field descriptions

flags
A signed 16-bit integer specifying which fields of the structure should be applied to the control; see "Control Font Style Flag Constants". If none of the flags in the flags field of the structure are set, the control uses the system font unless the control variant kControlUsesOwningWindowsFontVariant has been specified, in which case the control uses the window font.
font
If the kControlUseFontMask bit is set, then this element will contain an integer indicating the ID of the font family to use. If this bit is not set, then the system default font is used. A meta font constant can be specified instead; see "Meta Font Constants".
size
If the kControlUseSizeMask bit is set, then this element will contain an integer representing the point size of the text. If the kControlAddSizeMask bit is set, this value will represent the size to add to the current point size of the text. A meta font constant can be specified instead; see "Meta Font Constants".
style
If the kControlUseStyleMask bit is set, then this element will contain an integer specifying which styles to apply to the text. If all bits are clear, the plain font style is used. The bit numbers and the styles they represent are

 Bit
value
Style
 0Bold
 1Italic
 2Underline
 3Outline
 4Shadow
 5Condensed
 6Extended

mode
If the kControlUseModeMask bit is set, then this element will contain an integer specifying how characters are drawn in the bit image. See Inside Macintosh: Imaging With QuickDraw for a discussion of transfer modes.
just
If the kControlUseJustMask bit is set, then this element will contain an integer specifying text justification (left, right, centered, or system script direction).
foreColor
If the kControlUseForeColorMask bit is set, then this element will contain an RGB color to use when drawing the text.
backColor
If the kControlUseBackColorMask bit is set, then this element will contain an RGB color to use when drawing the background behind the text. In certain text modes, background color is ignored.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998